package com.cssw.fyzb.wap.controller;

import com.cssw.fyzb.base.web.context.UserContext;
import com.cssw.fyzb.base.web.domain.AjaxData;
import com.cssw.fyzb.base.web.domain.AjaxPage;
import com.cssw.fyzb.wap.model.vo.*;
import com.cssw.fyzb.wap.service.TurntableService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author wondream
 */
@RestController
@RequestMapping("/turntable")
public class TurntableController {

    private static final Logger logger = LoggerFactory.getLogger(UserController.class);

    @Autowired
    private TurntableService turntableService;

    @ApiOperation(value = "获取转盘信息")
    @GetMapping("getTurnableInfo")
    public AjaxData<GetTurntableInfoVo> getTurnableInfo() {
        return turntableService.getTurnableInfo(UserContext.getUserId());
    }

    @ApiOperation(value = "获取转盘礼物列表")
    @RequestMapping(value = "/getTurntable", method = RequestMethod.GET)
    @ResponseBody
    public AjaxPage<TurntableVo> getTurntable() {
        return turntableService.getTurntable();
    }

    @ApiOperation(value = "抽奖")
    @GetMapping("turn")
    public AjaxData<TurnResultVo> turn() {
        return turntableService.turn(UserContext.getUserId());
    }

    @ApiOperation(value = "获取抽奖记录")
    @RequestMapping(value = "/getTurntableLog", method = RequestMethod.GET)
    @ResponseBody
    public AjaxPage<TurntableLogVo> getTurntableLog() {
        return turntableService.getTurntableLog(UserContext.getUserId());
    }

    @ApiOperation(value = "增值记录")
    @RequestMapping(value = "/getGzAddPrice", method = RequestMethod.GET)
    @ResponseBody
    public AjaxPage<GzAddPriceVo> getGzAddPrice() {
        return turntableService.getGzAddPrice(UserContext.getUserId());
    }
}

